package com.example.hotsearchplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.hotsearchplatform.dto.HotTopDifferentDTO;
import com.example.hotsearchplatform.dto.HotValueByPlatformDTO;
import com.example.hotsearchplatform.pojo.entity.Analysis;
import com.example.hotsearchplatform.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

import java.util.List;

@Mapper
public interface AnalysisMapper extends BaseMapper<Analysis> {

    List<platformVO> getSearchCount();


    List<WordCloudVO> getAllWordCloud(@Param("platform") String platform);

    @Select("SELECT platform, SUM(hot_top) AS total_hot_top FROM analysis GROUP BY platform")
    @Results({
            @Result(property = "name", column = "platform"),
            @Result(property = "value", column = "total_hot_top")
    })
    List<HotValueByPlatformDTO> selectTotalHotTopGroupedByPlatform();


    List<Map<String, Object>> getHotTopByDifferentDay(@Param("hotTopDifferentDTO") HotTopDifferentDTO hotTopDifferentDTO);

}
